#ifndef __Configuration_HPP__
#define __Configuration_HPP__
#include <string>
#include <map>
#include <set>

using std::string;
using std::map;
using std::set;

class Configuration//单例模式
{
    Configuration(const Configuration &) = delete;
    Configuration operator=(const Configuration &) = delete;
public:
    static Configuration* getInstance();//这里调用私有的有参构造函数
    map<string, string> & getConfigMap();
    set<string> & getStopWordList();
private:
    string _filepath;
    map<string, string> _configMap;//Key是指代这是哪种文件路径，比如yuliao stop
    //value是存这种文件的所有绝对路径的文件的路径
    set<string> _stopWordList;//停用词集合，每行一个词
private:
    static Configuration* pCnof;//静态指针配合静态getinstance
    Configuration(const string & filepath);//存的是配置文件路径
    ~Configuration();
private:
    class AutoRelease
    {
    public:
        ~AutoRelease()
        {
            if(pCnof)
            {
                delete pCnof;
            }
        }  
    };
    static AutoRelease release;
};

/*
Configuration* Configuration::pCnof = nullptr;
Configuration::AutoRelease Configuration::release;
*/

#endif
